import requests

from common.token_ihrm import TokenIhrm
from script.ihrm_ import TestIhrm2


class EmpId:
    @classmethod
    def emp_ihrm(cls):
        ysy4_url = "http://ihrm2-test.itheima.net/api/company/department"
        ysy4_header = {"Content-Type": "application/json", "Authorization": TokenIhrm.token_login()}
        ysy4_body = {"name": "周天狗", "code": "38"}
        ysy4_reps = requests.post(url=ysy4_url, headers=ysy4_header, json=ysy4_body)
        emp_id = ysy4_reps.json().get("data").get("id")
        return emp_id


if __name__ == '__main__':
    emp_id = EmpId.emp_ihrm()
    print(emp_id)
